package models

import "gorm.io/gorm"

type Shop struct {
	gorm.Model
	Manager string  `gorm:"type:varchar(20)"`
	Address string  `gorm:"type:varchar(100)"`
	Tel     string  `gorm:"type:varchar(20)"`
	Price   float64 `gorm:"type:float(10,2)"`
	Status  string  `gorm:"type:enum('打烊','营业')"`
}

func (s *Shop) GetShopByAddress() error {
	return DB.Where("address = ?", s.Address).Limit(1).Find(&s).Error
}
func (s *Shop) CreateShop() error {
	return DB.Create(&s).Error
}
func (s *Shop) UpdateShop() error {
	return DB.Debug().Where("id = ?", s.ID).Updates(&s).Error
}
